import React, { Component } from 'react';
import {
  View,
  StyleSheet
} from 'react-native';
import { Dialog, Label, Button } from 'iftide';

export default class Basic extends Component {
  constructor(props) {
    super(props);
  }

  onClick1() {
    let child = (
      <View style={styles.children}>
        <Label text={'对话框'} />
      </View>);
    Dialog.show({
      children: child,
      spaceClose: false,
      onClose: () => {
        alert('函数触发方式：关闭回调函数1111')
      },
    })
  }

  onClickSpack() {
    let child = (
      <View style={styles.children}>
        <Label text={'函数触发方式——空白处可关闭'} />
      </View>);
    Dialog.show({
      children: child,
      spaceClose: true,
      onClose: () => {
        alert('函数触发方式：空白处可关闭')
      },
    })
  }

  render() {
    return (
      <View style={styles.outer}>
        <Button title={'OpenDialog函数触发方式'} onPress={() => this.onClick1()} />
        <Button title={'OpenDialog函数触发方式——空白处可关闭'} onPress={() => this.onClickSpack()} />
      </View>
    );
  }
}
const styles = StyleSheet.create({
  outer: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    height: '100%',
  },
  children: {
    height: 400,
    justifyContent: 'center',
    alignItems: 'center',
  }
});